home *** CD-ROM | disk | FTP | other *** search
/ Aminet 5 / Aminet 5 - March 1995.iso / Aminet / util / rexx / smacros.lha / FWMacros / Create_Table.arexx < prev    next >
Text File  |  1994-12-17  |  5KB  |  172 lines

  1. /* Create_Table
  2. A Macro by Steven. R. Giovenella, 5823 Dutchess Dr., Colorado Springs, CO 80918.
  3. © Copyright 1994 Steven. R. Giovenella, All rights reserved. 
  4. This macro is my gift to the Amiga community.  It may be given away free to 
  5. anyone, but it may NOT be sold in any way, shape, or form, not even for the cost of 
  6. reproduction, downloading, shipping, or handling, without express written 
  7. permission from the author listed above.  Any person or company who violates the 
  8. content of the previous sentence, agrees to pay Steven R. Giovenella $1,000 (US) for 
  9. each copy of this macro sold.  This macro may NOT be added to any disk which is to 
  10. be sold for any price or fee, to include shipping and handling.  The ONLY way this 
  11. macro may be distributed is on a disk which is given away 100% free of all charges, 
  12. or on via telecommunications networks which do not charge any additional fee as a 
  13. result of a user downloading this particular macro.  This macro may only be 
  14. reproduced in its entirety, including all comment lines and code.  The individual 
  15. user may alter this macro for personal use, but may not then distribute the macro 
  16. in any modified form.  If you wish, feel free to send me some cash, a Christmas card, 
  17. some other piece of software, or absolutely nothing as a gift for creating this macro.  
  18. The author of this software is not responsible for any data loss or damage to 
  19. computer equipment as a result, direct or indirect, of the use of this macro. */
  20.  
  21. Options results
  22.  
  23. /* Warning */
  24. Showmessage 2 0 '"                                   ** WARNING **" "            This Macro will 
  25. alter the current document." "Unless the document is empty, save before proceed
  26. ing." "      Proceed     " "      Save now        " "    Quit    "'
  27.     IF Result = 2 THEN SaveAs
  28.     IF Result = 3 THEN Exit
  29.  
  30. /* Initialize */
  31. Endline = 0
  32. offset = 0
  33. tabpos = 0
  34.  
  35. /* Establish Uniform Leading */
  36. Status FontSize
  37.     Sz = Result
  38.     NewLeading = trunc( Sz * 1.25 ) 
  39.     Leading NewLeading
  40. Spacing Variable
  41.  
  42. /* Box/Line Settings */
  43. ShowMessage 3 0 '"Enter Exterior line weight..." "" "" ".5 pt" "1 pt" "2 pt"'
  44.     IF Result = 1 THEN BoxPrefs LINEWT .5     
  45.     IF Result = 2 THEN BoxPrefs LINEWT 1
  46.     IF Result = 3 THEN BoxPrefs LINEWT 2
  47. ShowMessage 3 0 '"Enter Interior line weight..." "" "" "Hair" ".5 pt" "1 pt"'
  48.     IF Result = 1 THEN LinePrefs LINEWT Hairline
  49.     IF Result = 2 THEN LinePrefs LINEWT .5
  50.     IF Result = 3 THEN LinePrefs LINEWT 1    
  51.  
  52. BoxPrefs TEXTFLOW None FILL Transparent
  53. LinePrefs TEXTFLOW None
  54.  
  55. /* Get page # of insertion point*/
  56. Status Page "Insert"
  57.     pagenum = Result
  58.  
  59. /* Store current begline and endline */
  60. Status LinePos
  61.     Coords = Result
  62.     PARSE VAR Coords BegLine BegPos EndLine EndPos
  63.     IF ( EndLine = "" ) THEN Exit
  64.  
  65. /* View to 400% */
  66. View 400
  67. /* Move to end of document */
  68. MoveToLine 1000000 1000000
  69.  
  70. /* Insert a page break */
  71. InsertPageBreak
  72.  
  73. /* Movetoline begline */
  74. MoveToLine BegLine 0
  75. /* Get scroll position in inches */
  76. Status ScrollPos
  77.     Coords = Result
  78.     PARSE VAR Coords x top
  79.  
  80. /* Draw table */
  81. Status LineHeight
  82.     lh = Result
  83.     heightblock = ( EndLine - BegLine + 1 ) * lh
  84.     top = top - (lh * .04)
  85.  
  86. GetSectionSetup INSIDE OUTSIDE
  87.     coords = Result
  88.     PARSE VAR Coords inside outside    
  89. GetPageSetup Width Orient
  90.     coords = Result
  91.     PARSE VAR Coords widthright orient
  92. /* Figure Orientation */
  93. width = widthright - outside - inside 
  94. DrawBox 1 inside top width heightblock
  95.     FirstObj = Result
  96. View 100
  97.  
  98. /* Ask how many vertical sections */
  99. RequestText '"Create Table" "How many vertical sections?" ""'
  100.     Verticals = Result
  101. ShowMessage 1 0 '"  Would you like a title block?" "(no vertical dividers in top row)" 
  102. "" "Yes" 
  103. "Yes - Shaded" "No"'
  104.     Title = Result
  105.     If ( Title = 1 ) THEN DO
  106.         offset = lh
  107.         Begline = Begline + 1
  108.         DrawBox 1 inside top width lh
  109.         END
  110.     If ( Title = 2 ) THEN DO
  111.         BoxPrefs FILL Solid FILLCOLOR Yellow
  112.         offset = lh
  113.         Begline = BegLine + 1
  114.         DrawBox 1 inside top width lh
  115.         END     
  116.     
  117. /* Draw vertical sections */
  118. VertSec = width / Verticals
  119. Leftpos = inside + VertSec 
  120. bottom = top + heightblock
  121. limit = Verticals - 1
  122. top = top + offset
  123. DO i = 1 to limit
  124.     DrawLine 1 Leftpos top Leftpos bottom
  125.     Leftpos = Leftpos +VertSec
  126.     END
  127.  
  128. /* Draw horizontal sections */
  129. top = top + lh
  130. DO i = 1 to ( EndLine - BegLine )
  131.     DrawLine 1 inside top (widthright - outside) top
  132.     LastObj = Result
  133.     top = top + lh
  134.     End
  135.  
  136. /* Insert initial tabs */
  137. DO i = 1 to ( EndLine - BegLine + 1 )
  138.     MoveToLine ( BegLine + i - 1 ) 0
  139.     type "    "
  140.     END
  141.  
  142. MoveToLine 1000000 1000000
  143. Backspace
  144. MoveToLine BegLine 0
  145. FindCursor
  146. ShiftDown
  147. MoveToLine EndLine 1 
  148. ShiftUp
  149.  
  150.  
  151. /* Align tab positions */
  152. tabpos = VertSec / 2
  153. DO i = 1 to Verticals
  154.     Settab tabpos Center
  155.     tabpos = tabpos + VertSec    
  156.     END
  157.  
  158. IF Title ~= 3 THEN DO
  159.     MoveToLine ( Begline - 1 ) 0
  160.     Justify Center
  161.     MoveToLine ( BegLine - 1 ) 0
  162.     END
  163.  
  164. /* Group Table */
  165. DO i = FirstObj to LastObj
  166.     SelectObject i Multiple
  167.     END
  168. Group
  169. SelectObject
  170. MovetoLine EndLine 1000000
  171. redraw
  172.